package ${package.Mapper};

import ${package.Entity}.${entity};
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

/**
* ${cfg.controllerName} Mapper 接口
* @author ${author}
* @since ${date}
*/
<#if kotlin>
interface ${table.mapperName} : ${superMapperClass}<${entity}>
<#else>
@Mapper
public interface ${table.mapperName}{

    //添加${cfg.controllerName}
    int save(${entity} ${entity?uncap_first});

    //编辑${cfg.controllerName}
    int update(@Param("ew") UpdateWrapper<${entity}> query);

    //编辑${cfg.controllerName}
    int updateById(${entity} ${entity?uncap_first});
<#list table.fields as field>
<#if field_index == 0 && field.customMap.engine != "MRG_MYISAM">

    //添加${cfg.controllerName}(批量)
    int saveBatch(@Param("list") List<${entity}> ${entity?uncap_first}List);
</#if>
</#list>

    //通过id删除${cfg.controllerName}
    int removeById(${entity} ${entity?uncap_first});

    //通过id查询${cfg.controllerName}
    ${entity} selectById(@Param("id") Long id);

    //查询${cfg.controllerName}
    List<${entity}> select(@Param("ew") QueryWrapper<${entity}> query);

    //查询${cfg.controllerName}分页
    List<${entity}> select(Page<${entity}> page, @Param("ew") QueryWrapper<${entity}> query);

    //查询${cfg.controllerName}数量
    int selectCount(@Param("ew") QueryWrapper<${entity}> query);
}
</#if>
